fflush(stdout); /* and that, as they say, is that. All UFILE from here.. */
u_fprintf(OUT,"<HTML>");
u_fprintf(OUT, "\r\n<!-- \r\n\r\n Hello, HTML explorer :) Don't know how readable this HTML will be!\r\n If you have any questions, comments, [gasp] bugs, or\r\n [hopehope] improvements, please drop some knowledge to:\r\n icu4c@us.ibm.com THX! \r\n ~srl \r\n\r\n-->");
u_fprintf(OUT, "<BASE HREF=\"http://%s%s/\">\r\n", getenv("SERVER_NAME"), getenv("SCRIPT_NAME")); /* Ensure that all relative paths have the cgi name followed by a slash. */
FSWF("warningInheritedLocale", "Note: You're viewing a non existent locale. The ICU will support this with inherited information. But the Locale Explorer is not designed to understand such locales. Inheritance information may be wrong!"), dispName);
mySort(curLocale, &status, FALSE); /* Sort sub locales */
for(n=0;n<curLocale->nSubLocs;n++)
{
if(n != 0)
u_fprintf(OUT, ", ");
u_fprintf(OUT, "<A HREF=\"?_=%s\">%U</A>",
curLocale->subLocs[n].str,
curLocale->subLocs[n].ustr);
}
u_fprintf(OUT, "</UL>");
}
u_fprintf(OUT, "</TD></TR></TABLE>\r\n");
}
if ( tmp == NULL )
tmp = ""; /* for sanity */
if( ((!*tmp) && !setLocale && !setEncoding) || strstr(tmp, "PANICDEFAULT")) /* They're coming in cold. Give them the spiel.. */
{
u_fprintf(OUT, "</H2>"); /* close the 'title text */
u_fprintf(OUT, "<UL>%U<P>\r\n",
FSWF("introSpiel", "This demo illustrates the IBM International Classes for Unicode localization data. The classes cover 45 different languages, further divided into 154 geographic locales. For each language, data such as days of the week, months, and their abbreviations are defined. <P> The IBM Classes for Unicode are open-source. See the <A HREF=../project>ICU Project Page</A> for further information."));
u_fprintf(OUT, "</UL>");
}
/* Logic here: */
if( /* !setLocale || */ !strncmp(tmp,"locale", 6)) /* ?locale or not set: pick locale */
{
char *restored;
restored = strchr(tmp, '&');
if(restored)
{
restored ++;
}
if(!restored)
restored = "converter"; /* what to go on to */
if(setLocale)
u_fprintf(OUT, ": %U</H2>\r\n", FSWF("changeLocale", ": Change Your Locale"));
else
u_fprintf(OUT, ": %U</H2>\r\n", FSWF("chooseLocale", ": Choose Your Locale."));
/* No reason to use FSWF, this error means we have nothing to fetch strings from! */
u_fprintf(OUT, "<HR><B><I>Note: Could not open our private resource bundle %s, err %d </I></B><P>\r\n",
myBundlePath(), rbErr);
}
u_fprintf(OUT, "%U", FSWF( /* NOEXTRACT */ "htmlTAIL", "<!-- No HTML footer -->"));
/* a last resort. will switch to English if they get lost.. */
/* DO NOT localize the following */
/* What this does:
- brings them to the 'choose your locale' pane in English, then
- brings them to the 'choose your encoding' pane in their locale, then
- lists the locales to browse
*/
#ifndef NO_LOCALE_CHANGE
u_fprintf(OUT, "<A HREF=\"%s/en/iso-8859-1/?PANICDEFAULT\"><IMG SRC=\"%s/localeexplorer/incorrect.gif\" ALT=\"Click here if text displays incorrectly\"></A>", getenv("SCRIPT_NAME"), kStaticURLPrefix);
#endif
if(!strcmp(uloc_getDefault(),"klingon"))
u_fprintf(OUT, "<P>Thank you for using the ICU LocaleExplorer, from %s compiled %s %s<P>\r\n", LXHOSTNAME, __DATE__, __TIME__);
u_fprintf(OUT,"<TR><TD COLSPAN=2><FONT COLOR=\"#FF0000\">Warning, couldn't open the encoding '%s', using a default.</FONT></TD></TR>\r\n", couldNotOpenEncoding);
/* analyze what kind of locale we've got. Should this be a little smarter? */
#if 0
u_fprintf(OUT, "%U", FSWF("localeDataWhat", "This page shows the localization data for the locale listed at left. "));
if(strlen(locale)==2) /* just the language */
{
u_fprintf(OUT, " %U",FSWF("localeDataLanguage","No country is specified, so the data is generic to this language."));
}
else if(!strcmp(locale,"default"))
{
u_fprintf(OUT, " %U", FSWF("localeDataDefault", "This is the default localization data, which will be used if no other installed locale is specified."));
}
else if(locale[2] == '_')
{
if(strlen(locale) == 5)
{
u_fprintf(OUT, " %U", FSWF("localeDataLangCountry", "This Locale contains data for this language, as well as conventions for this particular country."));
}
else
{
u_fprintf(OUT, " %U", FSWF("localeDataLangCountryVariant", "This Locale contains data for this language, as well as conventions for a variant within this particular country."));
}
}
if(strstr(locale, "_EURO"))
{
u_fprintf(OUT, " %U", FSWF("localeDataEuro", "This Locale contains currency formatting information for use with the Euro currency."));
}
#endif
u_fprintf(OUT, "</TD></TR>\r\n");
u_fprintf(OUT, "</TABLE>");
status = U_ZERO_ERROR;
/* Show the explore.. things first. ======================*/
/* WIERD!! outputting '&#' through UTF8 seems to be -> '?' or something
[duh, HTML numbered escape sequence] */
u_fprintf(OUT, "<A HREF=\"?_=%s&SHOW%s&_#%s\"><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"%s/localeexplorer/closed.gif\" ALT=\"\">%U</A>\r\n<P>", locale, key,key, kStaticURLPrefix, FSWF("bigStringClickToShow","(Omitted due to size. Click here to show.)"));
/* WIERD!! outputting '&#' through UTF8 seems to be -> '?' or something
[duh, HTML numbered escape sequence] */
u_fprintf(OUT, "<A HREF=\"?_=%s&SHOW%s&_#%s\"><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"%s/localeexplorer/closed.gif\" ALT=\"\">%U</A>\r\n<P>", locale, key,key, kStaticURLPrefix, FSWF("bigStringClickToShow","(Omitted due to size. Click here to show.)"));
/* WIERD!! outputting '&#' through UTF8 seems to be -> '?' or something */
u_fprintf(OUT, "<A HREF=\"?_=%s&SHOW%s&_#%s\"><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"%s/localeexplorer/closed.gif\" ALT=\"\">%U</A>\r\n<P>", locale, key,key, kStaticURLPrefix, FSWF("bigStringClickToShow","(Omitted due to size. Click here to show.)"));
/* WIERD!! outputting '&#' through UTF8 seems to be -> '?' or something */
u_fprintf(OUT, "<A HREF=\"?_=%s&SHOW%s&_#%s\"><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC=\"%s/localeexplorer/closed.gif\" ALT=\"\">%U</A>\r\n<P>", locale, key,key, kStaticURLPrefix, FSWF("bigStringClickToShow","(Omitted due to size. Click here to show.)"));
sprintf(tmpChars, "%s -T %s %s %s ", kUSort, ourCharsetName, " -D -escape", sortTypes[n]); /* pass the -escape string if they asked for it */
fprintf(stderr, "OPENED: %s\n", tmpChars);
sortpipe = popen(tmpChars, "w");
if(!sortpipe)
{
u_fprintf(OUT, "<B>%U</B><BR>%s\r\n", FSWF("EXPLORE_CollationElements_PopenFailed", "Sorry, failed to popen the sort program!"), tmpChars);
}
else
{
fflush(stdout);
fflush(stderr);
fprintf(sortpipe, "%s\n", inputChars);
fflush(sortpipe);
pclose(sortpipe); /* that oughtta do it.. */
fflush(stdout);
fflush(stderr);
}
u_fprintf(OUT, "</PRE></TD>");
}
}
u_fprintf(OUT, "</TR></TABLE><P>");
u_fprintf(OUT, "<P><P>%U", FSWF("EXPLORE_CollationElements_strength", "There are four different strengths which may be used in collation.<P> Primary means that only primary differences are considered, such as letters. <P>Secondary considers letters, and also the secondary characteristics of accent marks. <P>Tertiary considers these two, and the case of the letter. <P> A strength of Identical means that all Unicode features are considered in determining a match."));
u_fprintf(OUT, "%U<P>", FSWF("formatExample_DateTimePatterns_What","This example demonstrates the formatting of date and time patterns in this locale."));
now = udat_parse(df, valueString, -1, &parsePos, &status);
}
/* Common handler for input errs */
if(U_FAILURE(status) || (now == 0))
{
status = U_ZERO_ERROR;
u_fprintf(OUT, "%U %d<P>\r\n", FSWF("formatExample_errorParse", "Could not parse this, replaced with a default value. Formatted This many chars:"), parsePos);
now = ucal_getNow();
}
status = U_ZERO_ERROR;
/* ======================== End loading input date ================================= */
if(U_FAILURE(status))
{
u_fprintf(OUT, "%U: [%d] <P>", FSWF("formatExample_DateTimePatterns_errorOpen", "Couldn't open the formatter"), (int) status);